package com.ybkj.daijia.api.gaode;

import com.ybkj.daijia.server.zhuan.SmallLocation;
import java.util.List;

/***
 * 高德api, 为HttpClient 和 RestTemplate 创建接口
 */
public interface GaodeApi {


    public static final String CREATE_PATH = "https://tsapi.amap.com/v1/track/trace/add?key={key}&sid={sid}&tid={tid}";

    public static final String UPLOAD_LOCATIONS = "https://tsapi.amap.com/v1/track/point/upload";

    public static final String GET_DISTANCE = "https://tsapi.amap.com/v1/track/terminal/trsearch?key={key}&sid={sid}&tid={tid}&trid={trid}&starttime={starttime}&endtime={endtime}&correction=mapmatch=1,attribute=1&recoup=1";

    public static final String DELETE_PATH = "https://tsapi.amap.com/v1/track/trace/delete?key={key}&sid={sid}&tid={tid}&trid={trid}";

    public static final String TRID = "trid";
    public static final String KEY = "key";
    public static final String SID = "sid";
    public static final String TID = "tid";
    public static final String STAR_TTIME = "starttime";
    public static final String END_TIME = "endtime";
    public static final String TRACKS = "tracks";
    public static final String DISTANCE = "distance";
    public static final String POINTS = "points";

    public static final int MAX_POINT = 100;

    public static final String ERROR_CODE = "errcode";
    public static final String ERR_MSG = "errmsg";
    public static final int SUCCESS_CODE = 10000;
    public static final String DATA = "data";

    /**
     * 创建轨迹
     *
     * @param key      高德应用key
     * @param sid      高德服务id
     * @param clientId 终端id
     * @return
     */
    Integer createPath(String key, int sid, int clientId);

    /***
     * 上传位置
     * @param list 轨迹点
     * @param key 高德应用key
     * @param sid 高德服务id
     * @param clientId 终端id
     * @param tridId 轨迹id
     * @return
     */
    boolean uploadLocations(List<SmallLocation> list, String key, int sid, int clientId,
        int tridId);

    /*** 获取路程
     * @param key 高德应用key
     * @param sid 高德服务id
     * @param clientId 终端id
     * @param tridId 轨迹id
     * @param startTime 查询开始时间
     * @param endTime 查询结束时间
     * @return
     */
    Double getDistance(String key, int sid, int clientId, int tridId, long startTime, long endTime);

    /**
     * 删除轨迹
     *
     * @param key      高德应用key
     * @param sid      高德服务id
     * @param clientId 终端id
     * @return
     */
    boolean deletePath(String key, int sid, int clientId, int trid);
}
